﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace FileMerge
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.ShowDialog();
			String path = ofd.FileName;
			textBox1.Text = File.ReadAllText(path);
			

		}

		private void button2_Click(object sender, EventArgs e)
		{
			OpenFileDialog ofd = new OpenFileDialog();
			ofd.ShowDialog();
			String path = ofd.FileName;
			textBox2.Text = File.ReadAllText(path);
		}

		private void button3_Click(object sender, EventArgs e)
		{
			String str = textBox1.Text + textBox2.Text;
			try {
			//FileStream fs = new FileStream("./Data/merge.txt", FileMode.Append, FileAccess.Write);
			StreamWriter sw = new StreamWriter("../../Data/merge.txt");
			sw.Flush();
			sw.Write(str);
			sw.Flush();
			sw.Close();
			}
			catch (Exception a)
			{

			}
			
		}
	}
}
